Factors out the common behaviors of all pieces 提取了所有對(duì)象的共有行為:
Factor out long expressions in the middle of statements 如果長(zhǎng)表達(dá)式在語(yǔ)句的中間,可以額外提出來(lái)。
Factoring out common code is a good practice , but it can t be applied in all cases 分解出公共代碼是一個(gè)很好的習(xí)慣,但它并不適用于所有的情況。
Cures and preventions : factor out the common code , if possible ; otherwise , update it 治療和預(yù)防措施:如果可能,分解出公共代碼;否則就對(duì)其進(jìn)行更新。
Just as before , we can minimize bugs of this sort by factoring out the common code 就象以前一樣,我們可以通過分解出公共代碼來(lái)將這種錯(cuò)誤控制到最少。
Of course , this example is one that a beginning programmer would quickly learn to avoid by factoring out the common code 當(dāng)然,這個(gè)示例所示的錯(cuò)誤是編程新手可以很快學(xué)會(huì)通過分解出公共代碼來(lái)避免的。
To improve performance , you may wish to factor out the code for each model attribute into its own method or a single method with a " switch " 要改進(jìn)性能,您可能希望將每個(gè)模型屬性的代碼分解成其自己的方法(或者是一個(gè)帶有“開關(guān)( switch ) ”的方法) 。
Relationships indicate that you want to look closely at similar use cases , trying to find commonality that can be factored out into " subset " cases or equivalents 關(guān)系表示您應(yīng)該密切關(guān)注相似的用例,嘗試查找共同點(diǎn),它們可以被分解成“子集”用例或等價(jià)物。
However , some negative factors out of network issue a grim challenge to the psychological health of college students who are destitute of self - restraint and resistance against temptation 同時(shí)又給自制力、抵御力不強(qiáng)的大學(xué)生心理健康提出了嚴(yán)峻的挑戰(zhàn)、產(chǎn)生了一些負(fù)面影響。
When each cast is held to this level of scrutiny , you may find yourself factoring out many of these casts by adding methods to the relevant subclasses 當(dāng)對(duì)每個(gè)類型強(qiáng)制轉(zhuǎn)換進(jìn)行這種級(jí)別的詳細(xì)審查時(shí),您可能會(huì)發(fā)現(xiàn)通過向相關(guān)的子類添加方法,您將許多這些類型強(qiáng)制轉(zhuǎn)換分解了。